package com.youth.api;

import com.youth.AddGroup;
import com.youth.entity.po.User;
import com.youth.result.ResultBean;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.constraints.NotBlank;

/**
 * @author: wuxian
 * @date: 2020/1/7 9:44
 */
public interface UserApi {

    /**
     * 登录
     *
     * @param userName
     * @param password
     * @return
     */
    ResultBean login(@NotBlank(message = "用户名不能为空") String userName, @NotBlank(message = "密码不能为空") String password);

    /**
     * 注册
     *
     * @param user
     * @return
     */
    ResultBean register(@Validated(value = {AddGroup.class}) @RequestBody User user);

    /**
     * 登出
     *
     * @return
     */
    ResultBean logout();

    /**
     * 根据名称获取权限
     *
     * @param userName
     * @return
     */
    ResultBean getUserPressionByName(String userName);

    /**
     * 根据名称获取角色
     *
     * @param userName
     * @return
     */
    ResultBean getUserRolesByName(String userName);
}
